
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>剪切板测试</title>
    <style>
        #foo {
            width: 100%;
            height: 200px;
            line-height: 20px;
            font-size: 20px;
        }
    </style>
</head>

<body>
    <!-- Target -->
    <textarea id="foo">jumeimall://page/alldetail?itemid=ht180724p3885212t2&type=global_deal&selltype=shopCart_goods&selllabel=normal_ht180724p3885212t2_702029589&urlexpirtime=1533781853648&shearplatesource=html</textarea>
    <!-- Trigger -->
    <button class="btn" data-clipboard-target="#foo">点我复制</button>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
    <script>
        var clipboard = new ClipboardJS('.btn');

        clipboard.on('success', function (e) {
            console.info('Action:', e.action);
            console.info('Text:', e.text);
            console.info('Trigger:', e.trigger);
            alert('复制成功，3秒后跳转');
            e.clearSelection();
            setTimeout(function(){
                window.location.href="http://a.app.qq.com/o/simple.jsp?pkgname=com.jm.android.jumei";
            },3000);
        });

        clipboard.on('error', function (e) {
            console.error('Action:', e.action);
            console.error('Trigger:', e.trigger);
            alert('复制失败');
        });
    </script>
</body>

</html>